Supporting Multiple TestProperty with the same key value.#328
Merged
navin22 merged 4 commits intomicrosoft:masterfrom Jan 10, 2017
Merged
Supporting Multiple TestProperty with the same key value.#328navin22 merged 4 commits intomicrosoft:masterfrom
navin22 merged 4 commits intomicrosoft:masterfrom
Conversation
Member
navin22
commented
Jan 9, 2017
- Changed the way of deserialization using custom TraitObject.
- Added UnitTests for the same.
- Changed the way of deserialization using custom TraitObject. - Added UnitTests for the same.
Member
Author
codito
reviewed
Jan 10, 2017
| // Converting Json data to array of KeyValuePairs with duplicate keys. | ||
| var serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<TraitObject>)); | ||
|
|
||
| var listOfTratiObjects = serializer.ReadObject(stream) as List<TraitObject>; |
Contributor
There was a problem hiding this comment.
s/listOfTratiObjects/listOfTraitObjects
codito
reviewed
Jan 10, 2017
| var listOfTratiObjects = serializer.ReadObject(stream) as List<TraitObject>; | ||
| listOfTratiObjects.ForEach(o=>listOfKvps.Add(new KeyValuePair<string, string>(o.Key, o.Value))); | ||
|
|
||
| return listOfKvps?.ToArray(); |
Contributor
There was a problem hiding this comment.
Why is null check required for listOfKvps?
codito
reviewed
Jan 10, 2017
| var serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(List<TraitObject>)); | ||
|
|
||
| var listOfTratiObjects = serializer.ReadObject(stream) as List<TraitObject>; | ||
| listOfTratiObjects.ForEach(o=>listOfKvps.Add(new KeyValuePair<string, string>(o.Key, o.Value))); |
Contributor
There was a problem hiding this comment.
Extra allocation and insertion into listOfKvps may not be required. Is something like below possible?
listOfTratiObjects.Select(t => new KeyValuePair<string, string>(t.Key, t.Value)).ToArray()
Member
Author
There was a problem hiding this comment.
Yes possible. Changed it.
codito
reviewed
Jan 10, 2017
Contributor
codito
left a comment
There was a problem hiding this comment.
Approach looks fine. Request few changes.
Member
Author
|
#239 issue is resolved by this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
